// import Vue from 'vue'

function getLocalstorage (name) {
  const res = JSON.parse(window.localStorage.getItem(name)) || []
  return res
}

/**
 *
 * @param {*} name 对象键名
 * @param {*} content 对象值
 * @param {*} that 将调用的组件对象传递进来，用来触发 $message
 */
function setLocalstorage (name, content, that = false) {
  window.localStorage.setItem(name, JSON.stringify(content))
  that && that.$message.success('新增成功')
}

export {
  getLocalstorage,
  setLocalstorage
}
